package br.com.agregador.persistencia.daoimpl;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

import org.springframework.stereotype.Repository;

import br.com.agregador.entity.Perfil;
import br.com.agregador.persistencia.dao.PerfilDAO;

@Repository("perfilDAO")
public class PerfilDAOImpl implements PerfilDAO {
	
	private static final long serialVersionUID = 1L;
	
	@PersistenceContext
	private EntityManager entityManager;

	@SuppressWarnings("unchecked")
	@Override
	public List<Perfil> recuperarPerfis() {
		StringBuilder sb = new StringBuilder("from Perfil ");
		Query query = entityManager.createQuery(sb.toString());
		return query.getResultList();
	}
}
